var currentScreen = 'splash_screen';
var screenContainer = null;
var screenHistory = new Array();

function onResize()
{
}
window.onresize = function(event)
{
	onResize();
}

function gotoScreen(screenName, goBack, avoidHistory)
{
	if(screenName != currentScreen)
	{
		document.body.scrollTo(0, 0);
		
		$(screenName).style.opacity = '0';
		$(screenName).style.display = '';

		new Fx.Tween($(currentScreen)).start('opacity', '1', '0').onComplete = function()
		{
			this.element.style.display = 'none';
		}
		new Fx.Tween($(screenName)).start('opacity', '1');
		
		if(!avoidHistory)
		{
			screenHistory.push(currentScreen);
		}
		
		if(screenHistory.length > 0)
		{
			menu.setRightSoftkeyLabel('Back', gotoPreviousScreen);
		}
		else
		{
			menu.setRightSoftkeyLabel('Exit', exit);
		}
		
		currentScreen = screenName;
	}
}
function exit()
{
	window.close();
}
function gotoPreviousScreen()
{
	if(screenHistory.length > 0)
	{
		var prevScreen = screenHistory.pop();
		
		gotoScreen(prevScreen, true, true);
	}
}
function showError(txt)
{
	alert(txt);
}